import axios from "axios";

const Service = axios.create({
    baseURL:"http://localhost:8080",
    timeout:5000,
});

Service.interceptors.request.use(
    config => {      
        return config;
    },
    error => {
        return Promise.reject({"code":1,"message":"请求失败，请检查网络"});
    }
 );


 Service.interceptors.response.use(
    response => {
        if (response.status == 200) {
            return Promise.resolve(response);
        } else {
            return Promise.reject(response);
        }
    },
    error => {
        return Promise.reject({"code":1,"message":"请求失败，请检查后台服务"});
    }
 );
export default Service;